From: Jonas Ã…dahl Date: Thu, 28 Nov 2019 10:19:27 +0000 (+0100) Subject: HACKING.md: Update sample code to use paint context X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~342 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8c4d07ba92e3293e4b406c0cef20be8ddd77c9ce;p=gnome-shell.git HACKING.md: Update sample code to use paint context https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/827 --- diff --git a/HACKING.md b/HACKING.md index 05176c45f..d1e23e03f 100644 --- a/HACKING.md +++ b/HACKING.md @@ -163,11 +163,17 @@ you to inherit from a type to use it, you can do so: return [100, 100]; } - vfunc_paint() { + vfunc_paint(paintContext) { + let framebuffer = paintContext.get_framebuffer(); + let coglContext = framebuffer.get_context(); let alloc = this.get_allocation_box(); - Cogl.set_source_color4ub(255, 0, 0, 255); - Cogl.rectangle(alloc.x1, alloc.y1, - alloc.x2, alloc.y2); + + let pipeline = new Cogl.Pipeline(coglContext); + pipeline.set_color4ub(255, 0, 0, 255); + + framebuffer.draw_rectangle(pipeline, + alloc.x1, alloc.y1, + alloc.x2, alloc.y2); } }); ```